<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <div id="app">
        <p>正确结果</p>
        <p>张-三</p>
        <p>----1. 插值----</p>
        <p>{{firstName + '-' + lastName}}</p>
        <p>----2. 函数----</p>
        <p>{{getFullName()}}</p>
        <p>----3. 计算属性----</p>
        <p>{{fullName}}</p>
    </div>

    <script type="text/javascript">
        var vm = new Vue({
            el: '#app',
            data() {
                return {
                    firstName: '张',
                    lastName: '三'
                };
            },
            methods: {
                getFullName() {
                    return this.firstName + '-' + this.lastName;
                }
            },
            computed: {
                fullName() {
                    return this.firstName + '-' + this.lastName;
                }
            }
        })
    </script>

</body>

</html>